package com.usian.rabbitmqdemo.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabitConfigX {

       /***
     * 创建交换机
     * @return
     */
    @Bean
    public DirectExchange directExchange(){
        return (DirectExchange)ExchangeBuilder.directExchange("cjexchange").delayed().durable(true).build();
    }

    @Bean
    public Queue messageQueue(){
        return new Queue("cjqueue", true);
    }

    @Bean
    public Binding directqueue(){
        return BindingBuilder.bind(messageQueue()).to(directExchange()).with("cj");
    }

}
